package no.spk.util.inforama.service.deployable;

import no.spk.util.inforama.service.pom.POM;
/**
 * @author Marius
 */
public class WebArchive implements Deployable {

	private final String name;
	private final String path;

	private POM pom;

	public WebArchive(String name, String path) {
		this.name = name;
		this.path = path;
	}

	public String getArtifactId() {
		return pom.getArtifactId();
	}

	public String getGroupId() {
		return pom.getGroupId();
	}

	public String getVersionAsString() {
		return pom.getVersionAsString();
	}

	public void setPOM(POM pom) {
		this.pom = pom;
	}
	
	public String getDeployableName() {
		return path;
	}

	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		WebArchive other = (WebArchive) obj;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}
}
